package com.seari.vehbaseP.service.impl;

import com.seari.vehbaseP.bean.BaseInfoBean;
import com.seari.vehbaseP.bean.CommonPartResponse;
import com.seari.vehbaseP.bean.DeviceParamBean;
import com.seari.vehbaseP.mapper.BaseInfoMapper;
import com.seari.vehbaseP.service.BaseInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("BaseInfoService")
public class BaseInfoServiceImpl implements BaseInfoService {

    @Autowired
    BaseInfoMapper baseInfoMapper;

    @Override
    public CommonPartResponse searchBaseInfo() {
        List<BaseInfoBean> list = baseInfoMapper.searchBaseInfo();
        return CommonPartResponse.success("success",list);

    }

    @Override
    public CommonPartResponse searchDeviceParam(String projectCode, String deviceId) {
        List<DeviceParamBean> list = baseInfoMapper.searchDeviceParam(projectCode, deviceId);
        return CommonPartResponse.success("success",list);
    }


    @Override
    public CommonPartResponse searchMatch(String match, int start, int limit) {
        int total=baseInfoMapper.searchMatchCount(match);
        List<BaseInfoBean> list = baseInfoMapper.searchMatch(match,start,limit);
        return CommonPartResponse.success("success",total,list);
    }
}
